home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / iutil / add_prim.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  913 b   |  48 lines

  1. # include    <ingres.h>
  2. # include    <access.h>
  3. # include    <sccs.h>
  4.  
  5. SCCSID(@(#)add_prim.c    8.1    12/31/84)
  6.  
  7. /*
  8. **    ADD_PRIM -- Add a primary page to the relation.  Assumes it is to
  9. **        be tacked onto page in current access method buffer.  No
  10. **        disk write is done but the page is marked for writing.
  11. **        It is assumed that the current page in access method buffer
  12. **        is the last physical page in the relation.
  13. **
  14. **    Trace Flags:
  15. **        26.0,2
  16. */
  17.  
  18. add_prim(d, tidx)
  19. DESC    *d;
  20. TID    *tidx;
  21. {
  22.     register struct accbuf    *b;
  23.     register int        i;
  24.  
  25.     b = Acc_head;
  26.     b->mainpg = b->thispage + 1;
  27.     b->bufstatus |= BUF_DIRTY;
  28.     if (i = pageflush(b))
  29.         return (i);
  30.  
  31.     /*
  32.     ** Now form the new primary page
  33.     */
  34.  
  35.     b->thispage = b->mainpg;
  36.     b->mainpg = 0;
  37.     b->ovflopg = 0;
  38.     b->linetab[0] = (int) b->firstup - (int) b;
  39.     b->nxtlino = 0;
  40.     b->bufstatus |= BUF_DIRTY;
  41.  
  42.     /*
  43.     ** Update tid to be new page
  44.     */
  45.     stuff_page(tidx, &b->thispage);
  46.     return (0);
  47. }
  48.